package com.itheima.oneToOne;

import com.itheima.bean01.Card;
import com.itheima.bean01.Person;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CardMapper {
    @Select("select * from card")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "number",property = "number"),
            @Result(
                    property = "p",
                    javaType = Person.class,
                    column = "id",
                    one=@One(select = "com.itheima.oneToOne.PersonMapper.selectAll")
            )
    })
    public abstract List<Card> selectAll();

}
